package com.top10.controller;

import com.top10.bean.ResponseBean;
import com.top10.entity.Advertise;
import com.top10.service.impl.AdvertiseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 广告信息Controller
 */
@RestController
@RequestMapping("/advertise")
public class AdvertiseController {

  @Autowired
  private AdvertiseServiceImpl advertiseService;


	@RequestMapping(value = "/getadvertise",method = RequestMethod.POST)
	@ResponseBody
	public ResponseBean getAdvertise(Integer type)throws Exception{
        if(type==null){
        	return ResponseBean.createError("你输入的参数为空");
		}
		List<Advertise> advertiseList=advertiseService.getAdvertise(type);
        return ResponseBean.createSuccess().addData("advertiseList",advertiseList);
	}
}
